package com.ithema.text;

import java.util.Scanner;

public class Test3 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入数组长度：");
        int is = sc.nextInt();
        int[]arr=new int[is];

        for (int i = 0; i < arr.length; i++) {
            System.out.println("请输入数组第"+(i+1)+"个数");
            arr[i] = sc.nextInt();
        }
        String s = arryToString(arr);
        System.out.println(s);
    }
    public static String arryToString(int []arr){
        StringBuilder sv=new StringBuilder("[");
        for (int i = 0; i < arr.length; i++) {
            if(i==arr.length-1){
                sv.append(arr[i]+"]");
            }else {
                sv.append(arr[i]).append(",");
            }
        }
        return sv.toString();

    }
}
